package com.mx.tool.helper;

import com.mx.tool.enums.EncryptionEnum;
import com.mx.tool.helper.impl.AESEncryp;
import com.mx.tool.helper.impl.DESEncryp;
import com.mx.tool.helper.impl.RC4Encryp;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: 徐建鹏.
 * @create: 2021-11-15 19:17
 * @Description:
 */
public interface IEncryp {

    String encrypt(String content, byte[] key);

    String decrypt(String content, byte[] key);

    String encrypt(String content, String key);

    String decrypt(String content, String key);

    byte[] getKeys();

    String getKey();


    static Map<String, IEncryp> init() {
        Map<String, IEncryp> encrypMap = new HashMap<>();
        encrypMap.put(EncryptionEnum.AES.value(), new AESEncryp());
        encrypMap.put(EncryptionEnum.DES.value(), new DESEncryp());
        encrypMap.put(EncryptionEnum.RC4.value(), new RC4Encryp());
        return encrypMap;
    }

}
